package com.smedi.ismedi.authoritymanagement.api.feign;

import com.smedi.ismedi.authoritymanagement.api.dto.request.*;
import com.smedi.ismedi.authoritymanagement.api.dto.response.ElementNodeResponse;
import com.smedi.ismedi.authoritymanagement.api.dto.response.ElementResponse;
import com.smedi.ismedi.web.starter.common.PaginationData;
import com.smedi.ismedi.web.starter.common.ResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @Author: xulinjun
 * @Date: 2021-7-15 15:46
 */
@Api(tags = {"元素"})
@FeignClient(name = "ismedi-authority-management")
@RequestMapping(value = "/api/v1/element")
public interface RemoteElementFeignApi {
    /**
     * 新增 元素
     *
     * @param elementCreateRequest 元素 新增 请求
     * @return ResponseData<ElementResponse>
     */
    @ApiOperation(httpMethod = "POST", value = "新增 元素")
    @PostMapping(value = "/create")
    ResponseData<ElementResponse> createElement(@Validated @RequestBody ElementCreateRequest elementCreateRequest);

    /**
     * 编辑 元素
     *
     * @param elementEditRequest 元素 编辑 请求
     * @return ResponseData<ElementResponse>
     */
    @ApiOperation(httpMethod = "POST", value = "编辑 元素")
    @PostMapping(value = "/edit")
    ResponseData<ElementResponse> editElement(@Validated @RequestBody ElementEditRequest elementEditRequest);

    /**
     * 批量 编辑 元素
     *
     * @param elementEditRequests 元素 编辑 请求
     * @return ResponseData<ElementResponse>
     */
    @ApiOperation(httpMethod = "POST", value = "批量 编辑 元素")
    @PostMapping(value = "/edit/batch")
    ResponseData<Boolean> editElements(@Validated @RequestBody List<ElementEditRequest> elementEditRequests);

    /**
     * 删除 元素
     *
     * @param elementRemoveRequest 元素 删除 请求
     * @return ResponseData<ElementResponse>
     */
    @ApiOperation(httpMethod = "POST", value = "删除 元素")
    @PostMapping(value = "/remove")
    ResponseData<Boolean> removeElement(@Validated @RequestBody ElementRemoveRequest elementRemoveRequest);

    /**
     * 获取 元素 单一
     *
     * @param elementOneRequest 元素 单一 请求
     * @return ResponseData<ElementResponse>
     */
    @ApiOperation(value = "获取 元素 单一", nickname = "获取 元素 单一")
    @PostMapping(value = "/one")
    ResponseData<ElementResponse> getElementOne(@Validated @RequestBody ElementOneRequest elementOneRequest);

    /**
     * 获取 元素 列表
     *
     * @param elementListRequest 元素 列表 请求
     * @return ResponseData<List < ElementResponse>>
     */
    @ApiOperation(value = "获取 元素 列表", nickname = "获取 元素 列表")
    @PostMapping(value = "/list")
    ResponseData<List<ElementResponse>> getElementList(@Validated @RequestBody ElementListRequest elementListRequest);

    /**
     * 获取 元素 分页
     *
     * @param elementPageRequest 元素 分页 请求
     * @return ResponseData<PaginationData < ElementResponse>>
     */
    @ApiOperation(value = "获取 元素 分页", nickname = "获取 元素 分页")
    @PostMapping(value = "/page")
    ResponseData<PaginationData<ElementResponse>> getElementPage(@Validated @RequestBody ElementPageRequest elementPageRequest);


    /**
     * 获取 元素 树
     *
     * @return ResponseData<List < TermPageResponse>>
     */
    @ApiOperation(httpMethod = "POST", value = "获取 元素 树")
    @PostMapping(value = "/tree")
    ResponseData<List<ElementNodeResponse>> getTree(@Validated @RequestBody ElementTreeRequest elementPageRequest);

    /**
     * 保存 角色与元素关系
     *
     * @return ResponseData<Boolean>
     */
    @ApiOperation(httpMethod = "POST", value = "保存 角色与元素关系")
    @PostMapping(value = "/role-element-relationship/save")
    ResponseData<Boolean> saveRoleElementRelationship(@Validated @RequestBody RoleElementRelationshipSaveRequest roleElementRelationshipSaveRequest);
}
